﻿using SPSAndong.Business;
using SPSAndong.UserControll;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SPSAndong.Forms
{
    public partial class FrmAndongBoard : Form
    {
        /// <summary>
        /// 类型：1、2、3、4
        /// </summary>
        public int[] _type;
        public string _name;

        BroadcastSetBLL broadcastSetBLL = new BroadcastSetBLL();

        ExceptionCallShow exceptionCallShow;

        public FrmAndongBoard()
        {
            InitializeComponent();
        }

        public FrmAndongBoard(int[] type,string name)
        {
            InitializeComponent();
            this._type = type;
            this._name = name;
        }

        /// <summary>
        /// 窗体加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmAndong_Load(object sender, EventArgs e)
        {
            var broadcastSetList = broadcastSetBLL.GetModelAll();
            //注册窗体注销事件
            this.Disposed += FrmAndong_Disposed;
            this.exceptionCallShow = new ExceptionCallShow(_type);
            //
            this.tableLayoutPanel1.Controls.Add(this.exceptionCallShow, 0, 1);

            //var broadcastSet = broadcastSetList.Where(x=>x.AreaType == _type[0]).FirstOrDefault();
            label2.Text = _name;
        }

        /// <summary>
        /// 窗体销毁
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmAndong_Disposed(object sender, EventArgs e)
        {
            this.exceptionCallShow.Dispose();
        }
    }
}
